package org.x.user.dto;

import lombok.Data;
import java.util.ArrayList;
import java.util.List;

@Data
public class MenuTreeNode {
    private Long id;
    private String name;
    private String path;
    private Long parentId;

    private String aclCode;
    private List<MenuTreeNode> children = new ArrayList<>();

    // 复制节点但不包含子节点的方法
    public MenuTreeNode copyWithoutChildren() {
        MenuTreeNode copy = new MenuTreeNode();
        copy.setId(this.id);
        copy.setName(this.name);
        copy.setPath(this.path);
        copy.setParentId(this.parentId);
        copy.setAclCode(this.aclCode);
        // 不复制children
        return copy;
    }
}
